<?php
$title = 'Драконы';
include_once '../inc/fnc.php';
if(isset($_GET['submit'])){
    $cost='100';
    $cos = $cost - $user['crys'];
    $login = trim(htmlspecialchars($_POST['login']));
    if($user['crys'] < $cost){
        $_SESSION['error']='<div class="plate_bg plate_spring">


<div class="plate_red">
<div class="plate_b_red">
<div class="plate_bl_red">
<div class="plate_icon_bg_red">
<div class="plate_crisis_crys">
<div class="plate_text">
<div class="plate_header">
Не хватает <span class="nwr"><img width="16" height="16" alt="" src="/images/crys_16.png">'.$cos.'</span>
</div>
<div class="cntr">
<a href="../bank">Купить кристаллы</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>





</div>';
header('location:./name');
exit;
    }else{
        $db->query('UPDATE `users` SET `login` = ?,`crys`=? WHERE `id`=?',array($login,$user['crys'] - $cost,$user['id']));
        header('location:../profile');
    }
}
?>
<div class="plate_nor mtb5 mlr10">
<div class="plate_nor_b">
<div class="plate_nor_l">
<div class="plate_nor_r">
<div class="plate_nor_rt">
<div class="plate_nor_rb">
<div class="plate_nor_lt">
<div class="plate_nor_lb cntr normal">
<div class="h1 major mt10"><span>Изменить имя</span></div>
<form class="cntr" id="id4" method="post" action="./name?submit"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input type="hidden" name="id4_hf_0" id="id4_hf_0"></div>

<input type="text" maxlength="16" class="w140 cntr" value="<?=$user['login']?>" name="login">
<span class="btn_g w140 mt5"><span class="btn_g_in"><input type="submit" value="Изменить"> за <span class="nwr"><img width="16" height="16" alt="" src="/images/crys_16.png">100</span></span></span>
</form>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="hr mt15"></div>
<div class="ml10 mt5">
<img src="/images/back_16.png" width="16" height="16" alt=""> <a class="info" href="../cfg">Настройки</a>
</div>
<div class="hr mt10"></div>
<?php
include_once '../inc/foot.php';
